package com.xinsilu.hospital.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author ym
 * @since 2021-11-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="AuthsysUser对象", description="")
public class AuthsysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "ur_id", type = IdType.AUTO)
    private Integer urId;

    private String urUserName;

    private String urPassword;

    private Integer urSalt;

    private String introduction;

    private String avatar;

    private String name;

    private List<AuthsysRole> roleList;

    private List<String> roles;

    public List<String> getRoles() {
        if(this.roleList != null){
            this.roles = new ArrayList<>();
            for(AuthsysRole role:roleList){
                this.roles.add(role.getRlName());
            }
        }
        return roles;
    }

    public void setRoles(List<String> roles) {
        this.roles = roles;
    }
}
